package cn.springcloudtest.service.impl;

import cn.springcloudtest.client.TopicClient;
import cn.springcloudtest.common.Dto;
import cn.springcloudtest.common.DtoUtil;
import cn.springcloudtest.pojo.Topic;
import cn.springcloudtest.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ProjectName:springcloud-topic-consumer
 * @Author:赵伟杰
 * @Date:2021年09月06日 8:41
 */
@Service
public class TopicServiceImpl implements TopicService {

    @Autowired
    private TopicClient topicClient;

    @Override
    public Dto<List<Topic>> getTopicList() {
        try {
            return DtoUtil.returnSuccess("查询成功", topicClient.getTopicListByMap(null));
        } catch (Exception e) {
            e.printStackTrace();
            return DtoUtil.returnFail("查询失败", "10000");
        }
    }


}
